'use strict';

const BaseController = require('../base');
const dayjs = require('dayjs');
const { Op } = require('sequelize');

class TravelSkuStockController extends BaseController {
  static get serviceName() {
    return 'business.travelSkuStock';
  }
  formatOrder() {
    return [
      ['travel_date', 'ASC']
    ]
  }
  afterFormatQuery(where, query) {
    return {
      ...where,
      // travel_date 大于今天
      travel_date: {
        [Op.gte]: dayjs().add(1, 'day').format('YYYY-MM-DD')
      }
    }
  }
  async batchDelete() {
    const { ctx } = this;
    const result = await ctx.service.business.travelSkuStock.batchDelete(ctx.request.body);
    ctx.success(result);
  }
}

module.exports = TravelSkuStockController; 